﻿package little.bunny;

import android.app.Activity;
import android.content.Intent;
import android.content.res.Configuration;
import android.net.Uri;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;

public class ShopContentActivity extends Activity {
	private Button bt1,bt4,bt5,backButton;
	private TextView bt2,bt3;
	//private String url;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.shop_content_layout);
		
		backButton=(Button)findViewById(R.id.back_button);
		backButton.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		
		final Intent myIntent=getIntent();
		bt1=(Button)findViewById(R.id.title_button_shop_con);
		bt1.setText(myIntent.getStringExtra("Title"));
		bt2=(TextView)findViewById(R.id.shop_address_bt);
		bt2.setText("联系电话："+myIntent.getStringExtra("Num"));
		bt3=(TextView)findViewById(R.id.shop_num_bt);
		bt3.setText("地址：  "+myIntent.getStringExtra("Address"));
		bt4=(Button)findViewById(R.id.button1);
		//System.out.println(myIntent.getStringExtra("Num").replaceAll("\\D*", ""));

		bt4.setOnClickListener(new View.OnClickListener() {
		  
			  public void onClick(View v) {
		    
		    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + myIntent.getStringExtra("Num").replaceAll("\\D*", "")));
			    startActivity(intent);
			    
			   }
			  });

		bt5=(Button)findViewById(R.id.button2);
		bt5.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				Toast.makeText(ShopContentActivity.this, "暂不支持！", Toast.LENGTH_SHORT).show();
			}
		});
		//获取 查看地图的 url
		//////url=getResources().getText(R.string.url)+myIntent.getStringExtra("Url");
		
	}
	
	@Override 
    
	public void onConfigurationChanged(Configuration newConfig) { 
		                super.onConfigurationChanged(newConfig); 
		                if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { 
			                        // land do nothing is ok 
			                } else if (this.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { 
				                        // port do nothing is ok 
				                } 
		        } 
}
